#include <Klein/Application/Application.h>
#include <Klein/Shader/GraphDatabase.h>

IMPLEMENT_APP(Application)

bool Application::OnInit()
{
	Fragment testFragmentA(FragmentIdentifier(_("testSL"), _("Generic"), _("A")));
	testFragmentA.AddParameter(Parameter(L"InputColor", Parameter::IO_INPUT, Parameter::DATA_COLOR, L"1.0 1.0 1.0"));
	testFragmentA.AddParameter(Parameter(L"InputFloat", Parameter::IO_INPUT, Parameter::DATA_FLOAT, L"1.0"));
	testFragmentA.AddParameter(Parameter(L"Output", Parameter::IO_OUTPUT, Parameter::DATA_FLOAT, L""));
	testFragmentA.Register();

	Fragment testFragmentB(FragmentIdentifier(_("testSL"), _("Generic"), _("B")));
	testFragmentB.AddParameter(Parameter(L"I", Parameter::IO_INPUT, Parameter::DATA_FLOAT, L"2.0"));
	testFragmentB.AddParameter(Parameter(L"O", Parameter::IO_OUTPUT, Parameter::DATA_FLOAT, L""));
	testFragmentB.Register();

	Fragment testFragmentC(FragmentIdentifier(_("testSL"), _("Generic"), _("C")));
	testFragmentC.AddParameter(Parameter(L"I", Parameter::IO_INPUT, Parameter::DATA_FLOAT, L"3.0"));
	testFragmentC.AddParameter(Parameter(L"O", Parameter::IO_OUTPUT, Parameter::DATA_FLOAT, L""));
	testFragmentC.Register();

	GraphRef defaultGraph(new Graph(GraphIdentifier(_("testSL"), _("default"))));

	GraphDatabase& graphDatabase = GraphDatabase::GetReference();
	graphDatabase.AddGraph(defaultGraph);

	mWindow = new WorkspaceFrame(NULL);
	mWindow->Show();

	return true;
}
